package com.amayadream.webchat.serviceImpl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.amayadream.webchat.dao.IUserDao;
import com.amayadream.webchat.pojo.User;
import com.amayadream.webchat.service.IUserService;
@Service(value = "userService")
public class UserServiceImpl implements IUserService {

	@Resource private IUserDao userDao;

	public List<User> selectAll(int page, int pageSize) {
		// TODO 自动生成的方法存根
		return userDao.selectAll(page, pageSize);
	}

	public User selectUserByUserid(String userid) {
		// TODO 自动生成的方法存根
		 return userDao.selectUserByUserid(userid);
	}

	public int selectCount(int pageSize) {
		// TODO 自动生成的方法存根
		int pageCount = Integer.parseInt(userDao.selectCount().getUserid());
        return pageCount % pageSize == 0 ? pageCount/pageSize : pageCount/pageSize + 1;
	}

	public boolean insert(User user) {
		// TODO 自动生成的方法存根
		  return userDao.insert(user);
	}

	public boolean update(User user) {
		// TODO 自动生成的方法存根
		return userDao.update(user);
	}

	public boolean delete(String userid) {
		// TODO 自动生成的方法存根
		return userDao.delete(userid);
	}

}
